const path = require('path')

function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  lintOnSave: true,
  devServer: {
    port: 8089
  },
  chainWebpack: (config) => {
    // 目录别名
    config.resolve.alias
      .set('@', resolve('src'))
      .set('api', resolve('src/api'))
      .set('assets', resolve('src/assets'))
      .set('utils', resolve('src/utils'))
      .set('components', resolve('src/components'))
      .set('layout', resolve('src/layout'))
      .set('page', resolve('src/page'))
      .set('static', resolve(__dirname, '../static'))

    // 配置标题
    config.plugin('html').tap((args) => {
      args[0].title = '开锐教育——系统模板'
      return args
    })
  },
  css: {
    loaderOptions: {
      less: {
        lessOptions: {
          javascriptEnabled: true
        }
      }
    }
  }
}
